<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
	<title>系统人员</title>
	<script th:src="@{/layui/layui.js}" type="text/javascript"></script>
	<link th:href="@{/layui/css/layui.css}" rel="stylesheet" />
	</head>
	<body>
		<div class="layui-container">
			<table id="region" lay-filter="region" class="layui-table layui-form"></table>
		</div>
		<script>
			var data=[ 
			{"name":"广西","type":"省","code":"100000","id":"1","pid":"0"},
			{"name":"广东","type":"省","code":"100000","id":"2","pid":"0"},
			{"name":"贵港","type":"省","code":"100000","id":"3","pid":"1"},
			{"name":"南宁","type":"省","code":"100000","id":"4","pid":"1"}
			]
			//加入插件模块
			layui.config({
				base:'/js/'
			})
    		layui.use(['form','layer','treeTable'],function(){
    			var form = layui.form,layer = layui.layer,
						treeTable = layui.treeTable;
    			
    			var trt = function(){treeTable.render({
    				elem:'#region',
					url:'/system/rc/find',
    				tree:{
    					showLine: false,
    					iconIndex:0,
    					isPidData:true,
    					idName:'id',
    					pidName:'pid',
    					openName:'open'

					},
    				cols:[
    				{field:'name',title:'区域名称',width:400},
    				{field:'type',title:'区域类型',width:300,
						templet:function (obj) {
							var type = obj.type;
							var str = "";
							if (type ==1){
								str = "<span style='color: #0C0C0C'>省</span>"
							}else if (type == 2){
								str = "<span style='color: #0C0C0C'>市</span>"
							}else {
								str = "<span style='color: #0C0C0C'>区</span>"
							}
							return str;
						}
					},
    				{field:'code',title:'区域编码',width:500}
    				/*{field:'id',title:'编号',width:150},
    				{field:'pid',title:'父编号',width:50}*/
    				],
					data:data
    			})
    			}
    			trt();
    		})

		</script>
	</body>
</html>
